package priv.mill.bigdata.jdbc;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;

public class TestHiveJdbc {

	
	public static void main(String[] args) {
		try {
			Class.forName("org.apache.hive.jdbc.HiveDriver");
			
			try (Connection conn = DriverManager.getConnection("jdbc:hive2://mini1:10000/jone");
					PreparedStatement ps = conn.prepareStatement("select * from freind");
					ResultSet rs = ps.executeQuery();){
				while(rs.next()) {
					for (int i = 1; i <= rs.getMetaData().getColumnCount(); i++) {
						System.out.print(rs.getObject(i));
					}
					System.out.println();
				}
			} 
			
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
}
